package com.rongxun.hbwallet.ui.activities;

import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.rongxun.base.BaseActivity;
import com.rongxun.base.HomeFragVpAdapter;
import com.rongxun.hbwallet.R;
import com.rongxun.hbwallet.ui.fragment.keystore.DeriveKeystoreQRCodeFragment;
import com.rongxun.hbwallet.ui.fragment.keystore.DeriveKeystoreStringFragment;
import com.rongxun.utils.StatusBarUtil;
import com.rongxun.view.ViewPagerIndicator;

import java.util.Arrays;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by dwq on 2018/3/27/027.
 * e-mail:lomapa@163.com
 */

public class DeriveKeystoreActivity extends BaseActivity {
    @BindView(R.id.toolbar_title)
    TextView           mToolbarTitle;
    @BindView(R.id.toolbar)
    Toolbar            mToolbar;
    @BindView(R.id.id_indicator)
    ViewPagerIndicator indicatorView;
    @BindView(R.id.vp_load_wallet)
    ViewPager          vpLoadWallet;
    @BindView(R.id.toolbar_back)
    ImageView          mToolbarBack;

    @Override
    protected void init() {
        StatusBarUtil.setToolBarPaddingTop(mToolbar, this);
        mToolbarBack.setVisibility(View.VISIBLE);
        mToolbarTitle.setText(R.string.derive_keystore_title);

        final String[] fnames = {
                DeriveKeystoreStringFragment.class.getName(),
                DeriveKeystoreQRCodeFragment.class.getName(),
        };

        String[] titles = {getString(R.string.derive_keystore_keystore)
                , getString(R.string.derive_keystore_qrcode)};


        HomeFragVpAdapter adapter = new HomeFragVpAdapter(getSupportFragmentManager(), this, fnames);

        indicatorView.setVisibleTabCount(2);
        indicatorView.setTabItemTitles(Arrays.asList(titles));

        vpLoadWallet.setAdapter(adapter);
        indicatorView.setViewPager(vpLoadWallet, 0);
    }


    @Override
    protected int getContentView() {
        return R.layout.activity_load_wallet;
    }

    @OnClick(R.id.toolbar_back)
    public void onViewClicked() {
        onBackPressed();
    }
}
